package Lintcode;

import java.util.*;

/**
 * Question: https://www.lintcode.com/zh-cn/problem/kth-largest-element/
 * Solution:
 * Time: 2018/4/30
 * Coder: Ksxy 
**/
public class Kth_largest_element {
    static Scanner scanner = null;

    static {
        scanner = new Scanner(System.in);
    }

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[] array = new int[m];
        for(int i=0; i < m; i++){
            array[i] = scanner.nextInt();
        }
        System.out.println(kthLargestElement(n, array));

    }

    public static int kthLargestElement(int k, int[] nums) {
        Arrays.sort(nums);
        return nums[nums.length-k];
    }
}
